package com.i2works.smartluolong.utils.base;

import java.util.Objects;

/**
 * 工作流-事项类型标识
 *
 * @author Liu Yutao <koal@vip.qq.com>
 * @date 2018/3/23 15:02
 */

public enum FlowItemTypeEnum {
    COMPANY_APPLY("companyApply", "公司注册"),
    COMPANY_CHANGE("companyChange", "公司变更"),
    COMPANY_RECORD("companyRecord", "公司备案"),
    MERCHANT_APPLY("merchantApply", "个体营业执照办理"),
    MERCHANT_CHANGE("merchantChange", "个体营业执照变更"),
    MERCHANT_RECORD("merchantRecord", "个体营业执照备案"),
    FOODDRUG_APPLY("fooddrugApply", "食药申请"),
    FOODDRUG_CHANGE("fooddrugChange", "食药变更"),
    FOODDRUG_CANCEL("fooddrugCancel", "食药注销"),
    DISABILITY_APPLY("disabilityApply", "残联申请"),
    DISABILITY_CHANGE("disabilityChange", "残联变更"),
    DISABILITY_REAPPLY("disabilityReApply", "残联补办"),
    DISABILITY_CANCEL("disabilityCancel", "残联注销");

    FlowItemTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    private String key;
    private String value;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    // 根据value返回枚举类型,主要在switch中使用
    public static FlowItemTypeEnum getByValue(String value) {
        for (FlowItemTypeEnum flowItemTypeEnum : values()) {
            if (Objects.equals(flowItemTypeEnum.getKey(), value)) {
                return flowItemTypeEnum;
            }
        }
        return null;
    }

}
